#pragma once
class Matrix4;
class Camera;
class Viewport;
class Material;

class RenderSystem : public Singleton<RenderSystem>
{
public:
	enum FillMode{
		FM_Point,
		FM_Wireframe,
		FM_Solid,
	};
	enum CullMode{
		CM_None,
		CM_Cw,
		CM_Ccw
	};
public:
	RenderSystem(void);
	virtual ~RenderSystem(void);
	bool create(
		HINSTANCE hInstance,
		HWND hwnd,
		int width, int height,
		bool windowed,
		D3DDEVTYPE deviceType);
	void destroy();

	void setWorldMatrix(const Matrix4& mat);
	void setViewMatrix(const Matrix4& mat);
	void setProjectionMatrix(const Matrix4& mat);
	void getProjectionMatrix(Matrix4 &mat, Camera *cam);
	void setViewport(Viewport* vp);
	void setFillMode(FillMode fm);
	FillMode getFillMode() const;
	void setCullMode(CullMode cm);
	CullMode getCullMode() const;
	void enableLight(bool bEnable);
	bool isEnableLight() const;
	IDirect3DDevice9* getD3DDevice(){
		return mDevice;
	}
private:
	IDirect3DDevice9* mDevice;

	Matrix4 mMaxView;
	Matrix4 mMaxWorld;
	Matrix4 mMaxProjection;

	Viewport* mViewport;
	FillMode mFillMode;
	CullMode mCullMode;
	bool mIsEnableLight;
};
